package com.zhn.evsi.client;

import com.alibaba.fastjson.JSONObject;
import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.Request;
import com.dtflys.forest.annotation.Retry;
import com.dtflys.forest.annotation.Var;
import com.zhn.evsi.domain.dto.evsi.contract.EvsiContractsDTO;
import com.zhn.evsi.domain.dto.evsi.contract.EvsiContractsItemsDTO;
import com.zhn.evsi.interceptor.TokenExceptionInterceptor;
import com.zhn.evsi.interceptor.TokenInterceptor;
import org.springframework.stereotype.Component;

import java.net.URL;
import java.util.List;

@Component
@BaseRequest(baseURL = "${eveData}${eveDataSns}", interceptor = TokenExceptionInterceptor.class)
@Retry(maxRetryCount = "3", maxRetryInterval = "1000")
public interface ContractsClient {

    /**
     * 获取
     * */
    // https://esi.evetech.net/latest/characters/2119634223/contracts/?datasource=tranquility&page=1&token=1%7CCfDJ8MrqJPYQd2lPo1rpmlAzyLVwneuZd3rRb8JrOIaZjjePpy9dBM5aztE37CueZ7NbOt6LexiAaEMa6P4CkAyiliY8j9YBSIe5wcvv8xBZgcUl1fU6dW97LQEUv20ERqNPOtDykGW5Uv4C49KiMqeOvH3ujD%2FNowHvl9zbXQT%2F%2BKwG
    @Request(
            url = "/characters/{characters}/contracts/?datasource=tranquility&page={page}",
            type = "GET",
            interceptor = TokenInterceptor.class
    )
    List<EvsiContractsDTO> contracts(@Var("characters") Integer characters, @Var("page") Integer page);

    /**
     *
     * */
    // https://esi.evetech.net/latest/characters/2119634223/contracts/187120102/bids/?datasource=tranquility&token=1%7CCfDJ8MrqJPYQd2lPo1rpmlAzyLUx3jljkTQnRjIk87BMU5f%2FOVPxDZ0%2BQEoSr7yYAvsMPZxHotcEO0yIxLz3hzTYqGr%2BX5R4DE%2BKUZlEk0tKiGnni96kgBkKD86EcbvIQF9R0Ao3pq%2BHxIWzAxfAELpR%2BCDpIHz5lGxnA5kwPWCoXXDR
    @Request(
            url = "/characters/{characters}/contracts/{contractsId}/bids/?datasource=tranquility",
            type = "GET",
            interceptor = TokenInterceptor.class
    )
    JSONObject contractsBids(@Var("characters") Long character, @Var("contractsId") Long contractsId);

    /**
     *
     * */
    // https://esi.evetech.net/latest/characters/2119634223/contracts/187120102/items/?datasource=tranquility&token=1%7CCfDJ8MrqJPYQd2lPo1rpmlAzyLUx3jljkTQnRjIk87BMU5f%2FOVPxDZ0%2BQEoSr7yYAvsMPZxHotcEO0yIxLz3hzTYqGr%2BX5R4DE%2BKUZlEk0tKiGnni96kgBkKD86EcbvIQF9R0Ao3pq%2BHxIWzAxfAELpR%2BCDpIHz5lGxnA5kwPWCoXXDR
    @Request(
            url = "/characters/{characters}/contracts/{contractsId}/items/?datasource=tranquility",
            type = "GET",
            interceptor = TokenInterceptor.class
    )
    List<EvsiContractsItemsDTO> contractsItems(@Var("characters") Integer characters, @Var("contractsId") Long contractsId);

    /**
     *
     * */
    // https://esi.evetech.net/latest/contracts/public/10000060/?datasource=tranquility&page=1
    @Request(
            url = "/contracts/public/{regionId}/?datasource=tranquility&page={page}",
            type = "GET"
    )
    List<JSONObject> contractsPublic(@Var("regionId") Integer regionId, @Var("page") Integer page);


    /**
     *
     * */

}
